<template>
  <div class="dashboard-home">
    <div class="welcome-card">
      <h3>欢迎回来, {{ userInfo.username }}!</h3>
      <div class="quick-actions">
        <el-button type="primary" @click="goToPurchase">
          <i class="el-icon-shopping-cart-2"></i>
          购买课程
        </el-button>
        <el-button type="success" @click="goToOrder">
          <i class="el-icon-s-order"></i>
          查看订单
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DashboardHome',
  data() {
    return {
      userInfo: {
        username: ''
      }
    }
  },
  created() {
    const user = JSON.parse(localStorage.getItem('user') || '{}')
    this.userInfo.username = user.username || '游客'
  },
  methods: {
    goToOrder() {
      this.$router.push('/dashboard/orders')
    },
    goToPurchase() {
      this.$router.push('/dashboard/purchase')
    }
  }
}
</script>

<style scoped>
.dashboard-home {
  padding: 20px;
  height: 100%;
  box-sizing: border-box;
}

.welcome-card {
  padding: 20px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  text-align: center;
}

.welcome-card h3 {
  font-size: 24px;
  margin-bottom: 20px;
  color: #409EFF;
}

.quick-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 20px;
}
</style> 